Moved the results creation logic to the algorithm module.