Done for the night. Not sure how much has changed in this version so
feel free to have a look throught the commit.