getting the message boxes to work correctly