Add a boolean for popup confirmation and remove unnecessary variables.