FIX ERROR & OPTMIZATION