Fix main states transitions
Fix all primary tests