Solution to third challenge