Implement user factory

It binds the environment of the callback function to this, as callbacks loose their environment.