Wrote parseInput function