'Refactored' parser.js [Refactoring]