improve input fn