Further work on refactoring the Gate API for #2107