[ref] Finish function extraction and promisification