added structure variable array, completed xcorr function, all the way down to the best correlation