cleanup: formatting, refactoring, .gitignore