parser.js cleanup and fixes