added test cases and made some changes in main