Some general improvements and cleanups. Split javascript to external file
and some html fixes.