clean up network and added function deleteFriend