Refactoring and shit