Cor nearest 1384 rebased

this is a interactive rebase of PR #1384   
dropping unrelated commits and fix minor merge conflicts

supersedes #1567