solution to 1.8-1.10