Code cleaning, refactoring