added some notes
tidied up coding