Updated filtering query