Refactor the handling of algorithms
Refactor