Type safe keys

This adds optional type safety via some extra book-keeping and API.  Usage is similar to the EnMAS State class, as evidenced by the included tests.