significantly refactor/annotate mgh1.py