Moved script into its own file