Cleaning up and refactoring.