working on new alg