Slight tidy-up, added documentation strings.