Wraps synchronous functions with a callback-style API