Connecting GUI with logic