Fixed a small bug when empty array and added the .each method