rapid refactoring, much more readable now