Replace globals with DI variables