making each() method match jQueries each()