Use findFirst in sanitize.
sanitize: Moved stack.push/pop to the outer level.