Merge "BUG-1704: rework state tracking"