refactored the coordinate class