Added support for iterating over an array

Accepts an array of objects as well as a single object. If an array is
provided for the data, the function iterates over the array and
populates the template for each. Fixed some underlying bugs