Start adding embedded webserver; improve shutdown slightly (still messy).