refactors array methods