rework first method to use .each method. not sure if it's better though