added the 5th case (exit)