refactored for exponents