A Appendix A.1 Implementation of DIST