adapting the PrologEngine class to the previous changes