little fiddles as I think about what to put where
add much of the residual-evaluation code