An attempt to improve performance - reuse elements of stack