making the comment insertion more flexible and share the same rules as the one in spider.js