Added more tests to increase test coverage
Refactoring of duplicate code