Stitching algorithm working