Move script into its own custom template event file