Add a level of abstraction over the choice of gain function