Handling network is unreachable error(s).
Refactoring repeated variable assignment.