Added vectorization algorithm. Changed thinning algorithm