Cleanup and added some more doc comments.