Remove stray occurrences of toX in code and docs

Both the docs and the code still referenced toX -- the former causes confusion, the latter an accidental global variable!

Fixes an issue raised by #669.