Include js dependencies in the template and cover MainTemplate with unit tests

Why?

You may find [this](http://webdesign.about.com/od/speed/a/script-placement-for-speed.htm) article interesting.