Adding check for descent direction