Refactor algorithm instantiation.