implemented writing to cluster