Promises/A+ implementation