Pulled out JS into separate file; small tweaks.