next_state() now takes parameter role