add peter's buffer
refactor
add peters hists
move some things around
minor