Changes for upstream

Hi Salomon!

These are our changes. We were liberal with renaming, so let me know if you would like me to revert our renames to preserve your public API. Thank you for a great library!