Refactor main class. Add dependencies to DI