revise ea965b8 and add tests.