some modifications re: review from @jmcphers