Bugfixes and cleanup for RSE.