Added Query functionality