refactored test to be more flexible