fix tests
remove index++
add function to calculate span of levels