partial solutions
Added solution and refactored