Changes suggested by @DavidPS incorporated