Add test cases, other updates.
add more test cases
cosmetic fixes