Wrote a function to read data from file

The function can easily be copy and pasted for each of the different
classes with a bit of modification. It works on my end, but may require
some tweaking to work with whole program. Take a look at it, I tried to
document it well.