Updated code to include prelimary script hooks.