General const and ref update to improve the performance