refactored the Point2D class