Use WriterT, move out runScript function