created isOnline method