Code cleaning and fixed exit button