State mechanism improved
Merge origin/master