better split function