Extracted duplicate algorithm methods into a module.