Change markerGen function to work with array of objects