Updated function to be const.