ironed out bugs from refactoring to use DI