improved 2(b), added auto test