Refactoring and cleaning up.