Refactored network code and merged in network preprocessor definitions.