Refactor mobilenetwork.js code (bug 1056088)