Support nested promises.

Closes #469