Updated Algorithm and Template