Why to change the return value from pointer to reference?