Update ms.py

simplified code!