Modifying the code so that it can support the each method.