Const corrections, further docs and variable name changes.