Adding Douglas Peucker simplify algorithm and some other changes.