Fixes #7
Various improvements