corrected the multiple algorithm calls