revised code to use Point class, cleaned up Trig functions