Refactoring some things