Refactor and rename some types in StackDepth code