added the required changes and few test cases