Added preliminary rough implementation of promises.