Refactor js to be meaner and cleaner

Reworked the `main.js` file to be cleaner. Also, moved the `<script>` tag out of the head and to the end of the layout. This allows us to remove the `$(document).ready();` function since the DOM will be loaded at this point.