Refactored test utils