reworked the Query to handle paramaterized types