Refactored step handling