Added stitching function.