implemented query for tags