added dynamic conditions based on the query