Refactored. Need handling of opening/closing nodes
Minor refactors
Minor refactors