replace val type to void *, suit for multiple data type