nicer algorithm to update button states (WIP)