merge and added test cases