Converted to use State monad.