move global options to function arguments