function reuse for stack, need to fix a huge error