DOCS-1251, DOCS-1244, and  Rassi's codereview comments for DOCS-1188