Fixes #439 - optimizes js placement

- moves requirejs scripts to the footer.
- makes yield syntax consistent.
- adds additional code comments in the main layout.