so much code refactoring omg.