Const correctness, code cleanup, very minor changes