Added docs and some math inlining (but no removed math routines).