Tweaks thanks to comments from @stof and @fprochazka