refactoring logic tests