made getVal() const. dear lord it changed a LOT
added const correctness