Updated the button logic.