Refactoring and Improvements