modified to read the input