added code to handle nested comments