Source: https://harvardforest.fas.harvard.edu/sites/harvardforest.fas.harvard.edu/files/exercises1-5_0.pdf