Added possiblity to read/write files. Also added tests for this