Removed a number of unnecessary scopes