Final algorithm finished