adding refactored solution for challenge 2