More separation into modules. Tidy up of code. Bug fixes. Auto format on save.