code tidy up added comments from blog