now correctly deals with infinite slopes (sort of)