Source: https://cs.au.dk/~amoeller/papers/tscheck/paper.pdf