Refactored test setup into separate functions