Added scope prolog term generator for before scope