Merge in changes from Andreas's branch.