Moved code to extra_script and page_script