refactors method by saving .length as a variable name