Seperated demo code into its own js file