updated parseInput() method