Added a promises/A+ compliant implementation of promises