Added possibility of reading input from file.