Implementation of rotating the pin depending on heading value.

Minor bug fixes.