Refactored application to use di