Cleanup parse.js with promises

 * Refactored so that it can optionally be used as a module.

Change-Id: I5b42fea1dabe50262090385dc8228284e55da553
Merge "Cleanup parse.js with promises"