delete stack logic