merge from improvements on the 1.0 branch: