Moved Javascript out of single-file HTML