added const to reference variables