Do general refactoring