Refactoring and code removal