Connecting the UI with the game logic