Updated code: using doParse()