Improve read and write methods.