Added const to various parameters and functions.