basic algorithm for double finished