Added a callback class

The binding functionality of the thread class has been moved into its own callback class such that it can be reused in user code.