Documentation and code cleanup of set_button_state.