Code Cleanup and orginization