Refactoring Main. Retrying to connect component.