Threading support

TODO: before/after callbacks does not run async.