start of using SM-stable methods for handling global vars