Fixes #21, #28.