Add function dynamic dispatch.
Add some test.