Fixes to Javascript

Moved all JS to the bottom, made sure jQuery is imported properly...