Best method for reading and writing files