generalized some data types and added a test case