Incorporate suggestions from @1jh
Incorporate suggestions from @jystewart