Moved JS to the bottom of template and removed a call to $(document).ready