rewrite the extension using Promises.