GUI refactoring: removed comments, moved the OK button event handler to a separate function + other minor changes