Code simplification and refactoring.