Make _unescape a function and add unit test