Raw, Mark Boorer's changes plus my edits on top of them

This is really just for Mark -- and in fact, Mark, just look at the last commit I added "beefed up raw metadata handling".