small refactor and unit test change