added readfrom and writeto