This seems wrong. We want to check if the highest bit is set, and if so, it means the leaves have been checked, so there's no point in checking again.