Code Cleanup and warning removal