Added funtion to square all elements in an array