some useful functions for DOC421