Support more data types and add tests.