More bug fixes, basic websockets added but not wired up

Started to abstract logging out into its own module and integration of
Websockets started.