Refactored parsing function
Refactored splitting function