refactored 35 solution