Added file reading, converted to library, adding unit tests