Tidied up the code and separated out the CSS and JavaScript.