add test cases and update docs