reduce copy-paste in aparser.js