Added exit button functionality