changed arrays from pointers to copies