added read and write methods for device