Complete merge by fixing errors and moving all the network code to the same package