Tidied up the code and added comments where I can.
Remove old project reference