Added automatic connection retries