Remove global variables and add 'verbose' flag