moving out packet writer to separate module