restructure RDM processing for enhanced readability of code
restructure RDM error branching for enhanced readability of code