Refactored step definition to remove duplication.