better code style and update test case