Moved scripts to top and renamed hooks