Optimizing hierarchy handling.