cleaned up code in network