Merge in lots of nice changes from quackenbush