Bleh, hardcore refactoring