added a callback function for when each element is completed
modified documentation