Finished Algorithm