Added writing inside arrays with writeFunction