Added logic for reading from file.