Code changes I made to get master script to work