modified stack to use stack pointer