added read and write method