refactor and add Point class