Clean up and refactor.