finished bdt script