some more careful merging with changes from master