Move promisified functions out of the actual function that uses them.
Move promisified functions out of the actual function that uses them.

cosmowiki/cosmowiki,cosmowiki/cosmowiki,cosmowiki/cosmowiki,cosmowiki/cosmowiki