Code Cleanup and typo fixing