added calss diagram
some tidying and housekeeping.