Fixes to cleanup script, optimizations in the UMRA-DB