switch to using transformers' State monad