refactored test