Rml cleanup

"Cleaned up" RML (iES) code. Main contributions:
 - Restructuring
 - Documentation
 - Eliminated Acopy and data->prior0. 
 - Renamed active_prior to prior.