Refactor app to use dependancy injection.