Code Cleanup

I merged into my code from your branch and conducted cleanup.