sgb: dist algorithm
Merge branch 'master' of github.com:allexk/sgb