Man, you are great , the problem was in this function:-
R = sqrt(pow(accXval,2)+pow(accYval,2)+pow(accZval,2));
accXangle = acos(accXval/R)*RAD_TO_DEG-90;
accYangle = acos(accYval/R)*RAD_TO_DEG-90;
I think it's not accurate or something as I was applying it in my old code and instead of (accXval/R), it was (Rxest/R) where Rxest is calculated using both acc and gyro readings. However, after I changed it with the one u sent me in the previous post, it worked so fine. Thank you so much.