more code formatting + added escaping method