finished implementing isValidAction() (completely untested)