Challenge 6 re-factored