Modified so that page refreshes after exit