Refactored MN stuff into master.py