added functionality to read from a file