Added better handling of exponents