My solution to 7.3.1 and 7.3.2