rename query to key, and allow passing a value in