added query.each function