Created a Point class, and refactored code