Refactor writing of blocks of events and indexs

Setting the stage for supporting compression.
Update indexes to use new binary index format.