Fixed escaping, cleaned up code.