Allow generator functions and promises