STSM: refactoring