Fixed most of the button logic.