Refactor.
Naive implementation of pow(x, n).
Handle error case.
Update with new algos.