Fixed jQuery each and map functions (added index)