clean up and a bit of refactoring