Code cleanup, comments, and fix StaticResources