Refactoring and clean up!