Added "const" keyword to functions

Added "const" keyword to functions which don't modify the passed values and to
functions which return data which should not be modified.
fixed test for latest changes