Turns regular functions into promises.