a little refectoring for decorator.py