STM implementation