added array read and write functionality