Still don't seem to have it quite right, but works on low number of paths...