Made some mods as suggested in PR 1826