Updates to get script working with sweep mode