Further improve stitching code. update documentation