Reimplemented the way packets are defined

Now it makes use of built-in MOP instead of my own clumsy and slow parody of it.
A few cosmetic changes