Fix various straightforward bugs in models.py.
Write transition script transition.py