Datalog improvements