Added handling of exponents

Slightly better than my last suggestion. Why doesn't git let you edit existing pull requests??
Merge pull request #125 from TheFiZi/patch-3

Added handling of exponents