issue #177: use dependency injection over globals