Overhaul packing algorithm

This fixes 2 bugs. One where indexes were mishandled and one where
raw blocks would always be empty.

Also, gofmt