passing type and alg