adding read and write methods for file