refactoring geometry