minor refactor, new test added