I don't think you need these three functions. The asserts aren't too useful (the code is fairly obvious in its maintenance of the depth), and the variable is self-explanatory (no one else should be calling these functions other than the expanders).