Initial cleanup.

Some initial cleanup of whitespace and semicolons.

Main change to start modularising by moving the view delegate to its own module.