added query filter and update query function