Cleanup and add comments.