P.S. You could use atan instead of atan2 but atan only returns an angle in the range -pi/2 to pi/2 (-90 to 90 degrees) in which case you have to figure out (from the signs of x and y) which quadrant the angle lies in and then correct it yourself. atan2 does that bit for you.
Pete