Updated command splitting function