fixed escaping bug and did small code refactoring