Add some comments and logging