added query filtering