add some logging, and clarification comments.