Tidy up the stack depth management code.
More tidying of stack management code.