refactor out next