change the code so can test with some DI