Add range checks for splits; fix up comments for clarity

Is it okay if we drop out of here with ref == "" or should this throw an error of some sort?