Packet build function now class method

Moved the function build outside of the packet class to share the
method for every instance instead of creating a new function for every
instance.