changed code back to state before popup changes