re-arranged NetworkService to put all public functions first and added comments