Source: https://www2.ph.ed.ac.uk/~paboyle/Teaching/SM_tutorials/StMod8.pdf