Cleaned things up a bit.

Separated CSS and JS to files; moved some JS into separate functions.