Merged dev

This brings in all the changes from the upstream branch.