Use io_lib:chars() instead of string() internally and reverse lists at
the end instead of appending.