added resetStack functionality