code for stm output