incorporate corrections from @samoht