Corrected the pop up at the end to be displayed only once