Fixes #439 - optimizes js placement

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