Code for S1 & S2 and habitat rarity tables.