more refactoring, woohoooooo