Finalizing Algorithm and Testing