updated test cases, refactoring as result of test