change from each by variable to chain call