Refactored soln
Refactored soln