store packet function

Hi Robbe,

I've improved your code.

You're welcome.