improved performance by changing @data to be an array instead of string