improved prolog