datalog added, monitor algorithm updated