STM algorithm implemented