doing dependency injection correctly