Added another test case
Minor refactoring