Improvements to packet parsing