Fixed bug where root was not a leaf. Now a leaf node is chosen.
Added ability to specify node weights.
Non-regular nodes now contribute weight.