Tidy up, add xmldoc comments.