Adding logic to the user interface