const-correctness concerns?

Const-correctness fixes. I am not sure why we are returning a const reference to an integer in some cases? Maybe I am missing something.