adds the controller logic