refactor to support multiple gathers