added network, simplified code and output.