moves reused variables into global scope for tests