polylines working

put through a bunch of fairly rigorous test cases and it doesn't seem to
fail at all.

also found a bug with closed / open lines causing no verticies to be
saved which I have fixed too.

basically up until this point the algorithm for decoding polylines was
slightly off, also there were a few little mistakes with the coding.
More testing required to 100% verify no issues with polylines and then
code can be optimized.