made some changes and returned some comments

Please let's sort out best strategy on loop prevention and replace-as
and get this published this week, sorry for delay on my side.