implement task state transitions