improved slim.py