rework handle_button_press to be a little cleaner