NodeFactory

I've overhauled the structure of nodes and added a simple factory with
unit tests.