a lot of refactoring and linting