Fixes #24 and #16