Refactoring
Added a test case