Refactored the split mehod