modified Lent algorithm