refactored. use parser.parse(){} block syntax for v1 compatibility.