Changes suggested by @jcollard and @seancorfield