Bug789 v1.2 part2

Rebased PR.