Source: http://people.cs.aau.dk/~bt/DAT5E07/PrgLIntro.pdf