Added comments / tidied code where appropriate

Hi @LorenzoBoccaccia  - Just some minor changes. I added comments / tidied code where appropriate.