Added test cases to cover new code