Added rudimentary ability to factor nodes and combine common factors.