refactored solution to 1