Moving to moment.js in node and browser, and some other general refactors