Making the example a bit more robust

I added a few functions to save lines and also included the trackPoints variable.
Merge pull request #1 from craigcannon/patch-1

Making the example a bit more robust