base detection script