Everything from line 71 up to line 163 is added / updated and should be reviewed.