Added an each() function which accepts a callback and loops through all elements