finished-fig1 and algorithm1