Issue #867: fix minor bug causing very wide graphs in some cases; improve long edge placement; comments + cleanup + minor refactoring