replaced legacy function with atomic