Fixed some typos, more output escaping, small efficiency fixes