Updated code to deal with den arrivals as last action