Broke key check out into a function so it can be called for mapped values as well as plain values. Added a test for it.