updated with query object pattern