Merge from 2.0. Tested.
Merged platform independent tests.