refactoring. Using arrays. end ch7