incorporating changes after discussion with Russel. Improving documentation.