cleaned up Network Layer subroutines to improve clarity
merge resolution