manually merge in changes from mdaines-r7