Updating with master
Removing references to math_ad routines
Corrected conflicts in merge with master
More conflict resolution.
Fixed more conflicts.