Moving the stack stuff to impure_stack.m