Merged

I developed each of the pull requests independently for easy independent review, but there were some pretty substantial conflicts between each. If those pull requests are acceptable, consider accepting this request instead, which resolves all of the conflicts.