Bugfixes, work on #41, #44