Misc improvements and bugfixes

Depends on PR #29 history