passed input by reference instead of making a copy