Implemented STM from slides