RMS: unflattening done. Largely untested. Function placeholder replacement also needs done.