removed a helper function that didn't really help. Added another return argument to AppendToArray; the key where the data was saved