re-indent record layer
first stab at separating record state from other state.
add some locks. unused for now