More work on the State monad