added diagram and fixed escaping issue