Just rewrote the stack to emulate the original C.

The original C code assumes that the stack items are never deallocated, so it
can look at items up the stack whenever it prefers. This can probably be
gotten rid of, but it's good to have the core functioning.