move main javascript into its own file