Replaced callback constructors with template constructor function.