Merged code

This code has stitching implemented in it. The code needs more
refinement. I see a couple of pointers in the code those need to be be
replaced with STL.