added more comments for documentation, rearranged code in SpanNode