Improve handling of keys and mappers; fixes #5 and #6

Improve handling of keys and mappers; fixes #5 and #6