Added normalization to keep angles between -pi and pi.