Readded calculation of descent, to fix issue #337.