Folding of the RNA is highly hierarchical, i.e., the primary sequence of an RNA molecule forms secondary structural elements through basepairs, which subsequently fold to tertiary domains/structures, usually through long-range interactions. Moreover, several domains from a large RNA can fold independently and then assemble into more complex structures. RNA folding is strongly affected by environmental factors, including magnesium ions.