Factorized code for iterator range split