Added network support and PEP8'ified the code