refactored file I/O and network I/O so that only 1 class gets passed in