moved JavaScript out to its own file