Rewrite it to use g_string_append_c instead of some homebrew stuff