Added support for optional labels on nodes

With a dash of re-factoring :)
Added unit tests for node label functionality

Includes bug fixes found in outcome of tests.