array refactoring, class functions