add test
some improvement