tidying up and some commenting

tidying up and some commenting