added validation to main window