All test cases are passed with some duplications of code