refactor with_items usage out