created function for comparing two arrays