Further simplification of exercise 2