Added const qualifier wherever it made sense.