Code cleaning + refactoring.