give this a bit more space
a bunch of refactoring and cleanup