Refactoring this class to remove some copy-paste duplicates (these were causing issues), generify things that are Node properties, move around some stuff to make it a little clearer.