add record querying
move query out to its own namespace