added optimization flag, minor cleanup in network.cpp