Refactor state transition handling