Add support for keys in query

Fixes issue #529