added clear function which clears the stack