RME - Code cleanup and documentation