added a function for wrapping asynchronous calls via channels