rewrite States as transition policy engine