cleanup and refactor
a lot more refactoring