Source: https://icawww1.epfl.ch/class-nooc/mod_stoc_ch6.pdf