Implement promise handlers.

Closes #190.