Refactor JS back out to external file.