RREF algorythm