refactor arrays