Merging improvements from bsx work.