Pass by reference to avoid unnecessary copies