more test cases and fine grained code