General refactoring