Made saveArray function