refactoring of point comparison