Check if isOnline only once.
Fix style issues.