Source: https://cs.uwaterloo.ca/research/tr/2008/CS-2008-13.pdf