Code for documentation in paper.