Minor improvements and add comments