Refactor RRDD code.