Finished datalog handler implementation.