Refactored/simplified the update to volatile var is visible to all thread working on it