Refactoring and Cleanup