solve exercise #6