added scoping for logging