Improving modularity further by merging duplicate code into parseNumber function