Refactor format.js, add explicit format parsers