Refactoring and other stuff