Fixed state management

Updating orders in parallel should be inside functions!