Squashed a few bugs
Changed node constructors to remove some code duplication