updating the button recognition logic