MasterControl with cleaned up code