refactored using arrays; 2.25 hours so far