use references instead of copies where possible