simplify the input grabbing code