modified SD1.py