Refactor for major performance improvements.

Here's a benchmark of datagram parsing.

Before:

```
N=1, mallocs: 31
N=100, mallocs: 3100
N=10000, mallocs: 310013
N=1000000, mallocs: 31000012
N=2000000, mallocs: 62000000
 2000000              7799 ns/op
```


After:

```
N=1, mallocs: 17
N=100, mallocs: 1010
N=10000, mallocs: 100011
N=1000000, mallocs: 10000009
N=10000000, mallocs: 100000008
10000000              1969 ns/op
```