refactored for migration to donrec extension