move header code to .cc
rename block to segment
fixed test using index segments.  Index segments aren't persisted yet though.