Adds thread safety for accessing the current scope. See #46