refactor to setoffense and set defense for clearer structure