Untested refactoring, but looks MUCH nicer