pass scanner by value so scanning does not consume buffer