Generalize boost-based function to non-constant neighbours
Fix the corner case script.  Corner case works fine.