Assignment #7 solution