Const-correctness of the code and new function