Promises/A+ implementation.