Refactored to use explicit node types (no longer using reflection mess)
Adding documentation