starting work on the query functionality
merging from master