Backports

Backport everything useful until 0640376e68a3947f0c2b82e877bdce9fa2735169

Travis for individual commits are in my fork. I will run partests as soon as I get to the office.