adjusted switch case for algorithm selection