added Il Joo's converted UAV threshold code