more refactoring, more fixing stuff I broke