changed read/write type to arrays