renamed a variable and moved logic that gets network address into a variable