added new test case, refactored code