restructed code a little bit. created a new module "stat" and moved some functions over to network_io