further work on improving/separating the gate API, #2107