changed alert to message box

also changed some variable names to improve logic/readability