Refactored the app to get better DI
added junit tests