Code Clean Up and Improvements