patch rebases for bug 783499 and 808370. updates to address review comments for bug 783499. updated to latest patch from bug 820524