adding basic network functions, finishing main code layout