Some refactoring for code removal