add test & use more consistent coding style