Many bugfixes and logging to server. fixes #54, fixes #53, fixes #47,
fixes #43, closes #32