More refactoring
DRY generisizing so can add TCP stack later