RSTP: refactoring