various old changes re-introduced and some updates from the rjleveque/updates branch