stax refactoring