consolidating a bunch of stuff relevant only for packet management in its own file