Modified classas and added new test cases.