Rename loop variable to cacheLevel and adjust offset to match
Use cache level instead of current cell level for cache construction