Test data types and properly support varints

Should we have unit test(s) for this function?