MAJOR refactoring sesh