Finish Algorithm 1 but may need to adjust the function order