It would be must simpler. Instead, it returns a string, which is obscure to say the least. Correcting this would require changing the API but in this case it is probably worth it.