[TIDOC-931] Rework code.