Refractored some code and added a restart popup