Major changes to master.py; still developing