Code improvement and refactoring.