Changes suggested by @megies