Add Test Cases, fix minor issues