use const reference where possible instead of copy