refactor into separated files and add geometry package