improved paco.py