rec_alg step 4 improvements