adding algs code