implementation of Promises/A+