added a `levelCount()` function