add callback support.
add test cases.