Removed 'const' from ref variables