Cleaning Up and Refactoring code.