Optimize SiteApp JS module

Also add comments