Updated to accomodate changes to main script