Refactoring before adding a new algorithm