Purer, smarter funcs; better var names.

Nate helped... I guess.
Merge into Euler repo
Merge into Euler repo