Added some additional error checking for complex numbers and nested exponentials.