Improved PacketStructure

To avoid creating a function on each new instance, and moved functions
inside loops, outside.
Fixed variable on the wrong scope

Also removed unnecessary spaces.
Merge pull request #65 from majimboo/master

Avoid function creation
```build``` function was moved to prototype to be shared between each packet instances.