Fixes #11, fixes #24, fixes #16