rde.py
this needs improvement