made major change to input reading