moved javascript into its own file
changed additional conditional
simplifying