new logic for reading input