Improved some commentary and added some "const"s