Automatic scope-handling of global functions